﻿#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using MilwormsGameData;
#endregion

namespace MilwormsGameContentPipeline
{
    [ContentTypeWriter]
    public class ItemWriter : MilwormsGameWriter<Item>
    {
        GearWriter gearWriter = null;

        protected override void Initialize(ContentCompiler compiler)
        {
            gearWriter = compiler.GetTypeWriter(typeof(Gear)) as GearWriter;

            base.Initialize(compiler);
        }

        protected override void Write(ContentWriter output, Item value)
        {
            // write out gear values
            output.WriteRawObject<Gear>(value as Gear, gearWriter);
        }

        public override string GetRuntimeType(TargetPlatform targetPlatform)
        {
            return typeof(MilwormsGameData.Item).AssemblyQualifiedName;
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(MilwormsGameData.Item.ItemReader).AssemblyQualifiedName;
        }
    }
}
